﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;
namespace DAO
{
    public class PhieuThuDAO
    {
        DataProvider dp;
        public PhieuThuDAO()
        {
            dp = new DataProvider();
        }
        public bool GhiPhieuThu(PhieuThuDTO ptdto, int mahd)
        {
            bool flag = true;
            string sql1 = "insert into PhieuThu(makhachhang, ngaythu, sotienthu) values ";
            sql1 += " (" + ptdto.Makhachhang + ", '" + ptdto.Ngaythu + "', " + ptdto.Sotienthu + ")";
            if (!dp.ThucHienCauTruyVan(sql1)) flag = false;
            string sql2 = "update HoaDon set tinhtrang = 1 where mahoadon = " + mahd + "";
            if (!dp.ThucHienCauTruyVan(sql2)) flag = false;
            return flag;
        }
    }
}
